import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-com-step-d',
  templateUrl: './com-step-d.component.html',
  styleUrls: ['./com-step-d.component.scss']
})
export class ComStepDComponent implements OnInit {


  get tableHeader() {
    return ['组合1', '组合2', '组合3', '组合4']
  }
  data = [
    {
      zb: 'A成本B效益',
      A: true,
      B: false,
      v1: false,
      v3: false,
      v5: true,
      v7: false,
      v9: false,
      getParams: () => {
        let j = this.data[0].A ? 'A' : 'B'
        let j1 = () => {
          let { v1, v3, v5, v7, v9 } = this.data[0];
          if (v1) return 1
          if (v3) return 3
          if (v5) return 5
          if (v7) return 7
          if (v9) return 9
        }
        return {
          j,
          j1: j1()
        }
      }
    },

  ]

  radioChange(item, type) {
    if (type == 'a') {
      item.B = false

    }
    if (type == 'b') {
      item.A = false
    }
  }

  ngOnInit() {
  }

  radioABChange(item, type) {
    if (type == 'a') {
      item.B = false

    }
    if (type == 'b') {
      item.A = false
    }
  }

  radioValueChange(item, key) {
    ['v1',
      'v3',
      'v5',
      'v7',
      'v9'].forEach(i => {
        if (i != key) {
          item[i] = false
        }
      })
  }

}

